/**
 * @Author: qinlong
 * @Date:   2018-04-27T15:14:31+08:00
 * @Last modified by:   pikaz
 * @Last modified time: 2018-05-03T18:17:47+08:00
 */

Component({
  properties: {
    item: {
      type: null,
    }
  },
  data: {},
  methods: {
    _tap(e) {
      var data = e.currentTarget.dataset;
      if (data.tap) {
        var detail = {};
        detail.ename = data.ename;
        this.triggerEvent('PickerTap', detail)
        console.log("tap")
      }
    },
    _change(e) {
      var data = e.currentTarget.dataset;
      var detail = e.detail;
      detail.ename = data.ename;
      this.triggerEvent('PickerChange', detail)
    }
  }
})
/*  // html
 <c-f-picker item="{{item}}" bindPickerChange="PickerChange" bindPickerTap="pickerTap"/>

*/

/*  //js data对象 结构
  item:{
        ename: 'date',
        name: '班次日期',
        mode: 'date',                 //单选  日期  时间选择器   更改 mode
        placeholder: '请选择班次日期',  
        array: Array,                 //单选 传入 数组
        rangeKey: 'name',             //单选的数组下标
        alignRight: false,            //靠左或靠右
        checkIndex: -1,               //选择下标
        checkItem:{} ,                //选中下标 
        point: true,                  //红色小标志
        disabled: true,               //是否禁用
        bindtap:true,                 //是否提供点击事件  提供点击事件需要禁用picker
      }
*/
/*  //js event事件
  PickerChange(e) {
    var ename = e.detail.ename;
    var value = e.detail.value;
    var applyList = this.data.applyList;
    applyList.find((one,i,arr)=>{
      if(one.ename == ename){
        if(one.mode == "date" || ename == "time"){  //其它的类同
          one.checkIndex = 0;
          one.value = value;
          one.checkItem = value;
        }else if(one.mode == "selector"){
          if(one.array.length > 0){
            one.checkIndex = value;
            one.checkItem = one.array[value];
            if (one.rangeKey){
              one.value = one.array[value][one.rangeKey];
            }else{
              one.value = one.array[value]
            }

          }else{
            wx.showToast({
              title: '无内容可选',
              icon:'none'
            })
          }

        }
      }
    })
    this.setData({
      applyList
    })
  },

*/
/*  //js event事件
  PickerChange(e) {
    var ename = e.detail.ename;
    var value = e.detail.value;
    var applyList = this.data.applyList;
    applyList.find((one,i,arr)=>{
      if(one.ename == ename){
     
          if(one.array.length > 0){
            one.checkIndex = value;
            one.checkItem = one.array[value];
            if (one.rangeKey){
              one.value = one.array[value][one.rangeKey];
            }else{
              one.value = one.array[value]
            }

          }else{
            wx.showToast({
              title: '无内容可选',
              icon:'none'
            })
          }
      }
    })
    this.setData({
      applyList
    })
  },

*/
